package com.gs.wechatdemo.util;


import com.gs.wechatdemo.MyApplication;

public class DensityUtil {
    public static int dp2px(float dp){
        float scale = MyApplication.getContext().getResources().getDisplayMetrics().density;
        return (int) Math.ceil(dp * scale);
    }

    public static float sp2px(float sp){
        float scale = MyApplication.getContext().getResources().getDisplayMetrics().scaledDensity;
        return sp * scale;
    }
}
